<template>
  <div class="about">
    <el-button @click="handler">退出登录</el-button>
    
    <MenuListComp :menu-list="getMenuList"></MenuListComp>
    <router-view></router-view>
  </div>
</template>
<script>
import { resetRouter } from '@/router/index'
import MenuListComp from './MenuListComp.vue'

export default {
  name: 'AboutView',
  components: {
    MenuListComp
  },
  computed: {
    getMenuList(){
      return this.$store.state.userAuth.userFinallyMenus
    }
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handler(){
      // 返回登录页
      this.$router.push('/')
      // 清除token
      localStorage.removeItem('token');
      // 清除已经添加的动态路由 但是还能点回来
      resetRouter()

      // 应该是对的
      this.$store.commit('userAuth/SET_USER_FINALLY_MENUS', []);
      
      // 刷新页面
      location.reload(true);
    }
  }
}
</script>
